Vikrant
Converting Ideas Into Business
Monday, January 12, 2009
Can not access MySql from Shell?
Do following changes on your server with root login to access shell MySql prompt.
# vi /root/.my.cnf
[client]
user= admin [This should be Plesk Username]
password="password" [Just change this password to Plesk password]
Save the file.
If it wont work then try restarting mysql with following command.
# /etc/init.d/mysqld restart
Saturday, October 11, 2008
ImageMagick Installation easy steps
Fire following commands
# wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
# tar xvfz ImageMagick.tar.gz
[It will create the folder ]
# cd ImageMagick-6.?.?
# ./configure
# make
# make install
Test it
For resizing
# /usr/local/bin/convert -resize 100X100 marmik1.png marmik_thum.png
For converting
# /usr/local/bin/convert marmik1.png marmik1.gif
How to Run with PHP?
Refer my previous post http://vikrant_labde.blogspot.com/2008/02/run-ffmepg-command-with-php.html get the php function form there of ur exec() or system() command failed.
runExternal("/usr/local/bin/convert -resize 100X100 marmik1.png marmik_thum.png", $code );
if($code != "") print "its error mate";
?>
More functions
http://www.imagemagick.org/script/convert.php
Monday, October 06, 2008
TinyMCE for specific textareas
WYSIWUG editor, which is really stupid stuff by them though.
I have searched a lot about allowing tinyMCE for particular Textareas on the page and its really a common discussion topic on the forum but I haven't got any satisfactory answer. I dont know why all answers are only for Dupal implementation grrrrrrrrr.
Then I looked into tiny_mce.js and I found something like "spefic_textarea" and I searched into tinyMCE manual for this keyword (http://wiki.moxiecode.com/index.php/Special:Search?ns100=1&ns106=1&ns108=1&search=specific_textareas&searchx=Search) and found some help.
Heres is code which will solve your problem.
tinyMCE.init({
// General options
mode : "exact",
elements : "textarea_id1,textarea_id2", // just pass the ID's of your textarea for which you
// want to add the editor
// Your code related other settings, keep it same
cheers..
Wednesday, July 30, 2008
QueryString in .htaccess - Match Question Mark in rewrite rule
and I thought it's cool if I represent all URLs like google (http://www.google.co.in/search?hl=en&client=firefox-a)
so http://mysite.com?index.php?action=search&q=vikrant should look like http://mysite.com/search?q=vikrant
for this purpose I have first tried a simple rule to match anything after "/".
RewriteEngine On
RewriteRule ^(.*)$ index.php?action=$1 [L]
but when I print GET variables then it s only giving me the part before "?" (that was strange)
Then after googling a bit I just got the hint that Mod Rewrite do not matches string after "?"
because it's treating it as %{QUERYSTRING}, hence I have created following rule to achieve the result which is running perfect for me
RewriteEngine On
RewriteRule ^/?([^/][^\./]*)[:;,\.]*$ index.php?action=$1&%{QUERY_STRING} [L]
Saturday, May 31, 2008
No vhost.conf in httpd.include OR Changing default DocumentRoot directory
single DocumentRoot for that purpose I opend httpd.include (for plesk normally present
in /var/www/vhsots/
setting in vhost.conf if u want, but there was no vhost.conf in the /conf directory
hence I created it (vi vhost.conf) and enter following code in it
DocumentRoot /path/to/new/documentroot
php_admin_flag engine on
php_admin_flag safe_mode on
php_admin_value open_basedir "/path/to/new/documentroot:/tmp"
and restarted my server, but changes didnt reflect hence I googled and found following
solution.
If you dont find following "Include /var/www/vhosts/conf/
in httpd.include then run following command
/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=yourdomain.com
Plesk will add "Include" statement in httpd.include
And restart the server (service httpd restart OR /etc/init.d/httpd restart)
And Cheers..
---
I have found one more solution which is I can say technical cheating :) by creating
symbolic link
you remove any custom changes in your vhost.conf file and remove or rename the httpdocs directory entirely.
Then you run ln -s /path/to/new/documentroot httpdocs which will create the link.
This way Apache will still read from /path/to/old/documentroot and all the
settings will apply correctly, but the files are actually stored on the new path.
Friday, February 29, 2008
Run ffmpeg command with php
Hi,
In my last article I have tackled the problem for ffmpeg
installation when u dont have YUM installed on your server,
on same day I have again faced problem with execution of
ffmpeg commands from php and I have found below solution
for this on google
array("pipe", "r"), // stdin is a pipe that the child will
read from
1 => array("pipe", "w"), // stdout is a pipe that the child will
write to
2 => array("pipe", "w") // stderr is a file to write to
);
$pipes= array();
$process = proc_open($cmd, $descriptorspec, $pipes);
$output= "";
if (!is_resource($process)) return false;
#close child's input imidiately
fclose($pipes[0]);
stream_set_blocking($pipes[1],false);
stream_set_blocking($pipes[2],false);
$todo= array($pipes[1],$pipes[2]);
while( true ) {
$read= array();
if( !feof($pipes[1]) ) $read[]= $pipes[1];
if( !feof($pipes[2]) ) $read[]= $pipes[2];
if (!$read) break;
$ready= stream_select($read, $write=NULL, $ex= NULL, 2);
if ($ready === false) {
break; #should never happen - something died
}
foreach ($read as $r) {
$s= fread($r,1024);
$output.= $s;
}
}
fclose($pipes[1]);
fclose($pipes[2]);
$code= proc_close($process);
return $output;
}
Monday, February 25, 2008
How to Install ffmpeg?
I have spent hell three hours on finding the quick ffmpeg installer, and on my system YUM is also not working
I guess this similar kind of problem will be there with you also. Following are the easy stpes to install FFMPEG on your sever
My System is RedHat EL 4.
FFMPEG installation for RedHat EL 4 - i386
This installation will run probably for all i386 systems.
# rpm -Uvh --nodeps ftp://ftp.univie.ac.at/systems/linux/dag/redhat/el4/en/i386/RPMS.dag/ffmpeg-0.4.9-0.9.20070530.el4.rf.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.pbone.net/mirror/atrpms.net/el4-i386/atrpms/stable/libogg0-1.1.3-7.el4.at.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.univie.ac.at/systems/linux/dag/redhat/el4/en/i386/dag/RPMS/gsm-1.0.10-6.el4.rf.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.pbone.net/mirror/atrpms.net/el4-i386/atrpms/stable/libmp3lame0-3.97-16.el4.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.pbone.net/mirror/atrpms.net/el4-i386/atrpms/stable/libvorbis0-1.1.2-5.el4.at.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.pbone.net/mirror/atrpms.net/el4-x86_64/atrpms/stable/libvorbisenc2-1.1.2-5.el4.at.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.univie.ac.at/systems/linux/dag/redhat/el4/en/i386/RPMS.dag/xvidcore-1.1.3-1.el4.rf.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.univie.ac.at/systems/linux/dag/redhat/el4/en/i386/dag/RPMS/x264-0.0.0-0.4.20070529.el4.rf.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.pbone.net/mirror/atrpms.net/el4-i386/atrpms/stable/libfaac0-1.25-2.el4.at.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.pbone.net/mirror/atrpms.net/el4-x86_64/atrpms/stable/faad2-2.5-7.el4.at.i386.rpm
Get sample MPEG file
wget http://www.fileformat.info/format/mpeg/sample/031699cb978244b8a3adf1e81cb2ac7c/FORM.MPG
Convert MPEG from FLV
ffmpeg -i FORM.MPG -ar 22050 -ab 32 -f flv -s 320x240 -aspect 4:3 -y
Convert IMAGE From FLV
ffmpeg -i FORM.flv -deinterlace -an -ss 1 -t 00:00:01 -r 1 -y -s 320×240 -vcodec mjpeg -f mjpeg form.jpg
RPMS Taken From
http://rpm.pbone.net/
ffmpeg help Articles
http://ffmpeg.mplayerhq.hu/faq.html
http://www.luar.com.hk/blog/?p=670
Monday, July 30, 2007
AJAX Request timeout problem on Linux
I have been working/playing with AJAX quite long time, during which I have evolved the lots of things about AJAX, its advantages and disadvantages.
Few months ago My Team was working on http://www.jyve.com and we are using AJAX in heavy range for http://www.jyve.com which is suppose to be first Ask An Expert engine in the web world.
Remember your one AJAX request opens one TCP connection to your server, you can see those connection with following commands
# netstat -tap
You can see the requests in various states like TIME_WAIT, LISTEN
If you find lots of http request in CLOSE_WAIT or FIN_WAIT status it means there is a problem.
Now I wont tell you how write a script for AJAX that you can find anywhere on google :).
I just want to warn you before using AJAX that if you are transferring huge amount of data via AJAX request then your server gonna create problem for you. Following is remedy which you can use for best performance of AJAX requests.
open /etc/sysctl.conf file (this is Kernel Settings file)
And add following code at the end of the file
# ADDED BY VIKRANT - 7/12/2006-----------
# For avoid to have a big TCP queue and so memory usage for not really
# active connection I decrease some TCP timeout and force the kernel to
# recycle quickly tcp connection. We don.t cache the value of ssthresh
# (Slow Start Threshold) for avoid to impact a given host to have a reduced
# ssthresh for all is next connections.
net.ipv4.tcp_keepalive_time=300
net.ipv4.tcp_fin_timeout=30
net.ipv4.tcp_max_orphans=16384
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_rfc1337=1
net.ipv4.tcp_no_metrics_save=1
# It.s critical to use the optimal SEND and RECEIVE socket buffer size for the link
# you are using. In our case we have a 100Mbits link connection. So for a better TCP
# connection and congestion control we had to increase the TCP Buffer
net.core.rmem_max=16777216
net.core.wmem_max=16777216
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_wmem=4096 65536 16777216
After that Fire following command
# sysctl -p /etc/sysctl.confFor more reference you read really one really great post Fine tuning a Linux Apache MySQL PHP (LAMP) server
----------
Enjoy the AJAX power!!!!
Monday, May 08, 2006
This article is taken from http://www.rfc-editor.org/
WHAT are RFCs ?
The Request for Comments (RFCs)
The Requests for Comments (RFC) document series is a set of technical and organizational notes about the Internet (originally the ARPANET), beginning in 1969. Memos in the RFC series discuss many aspects of computer networking, including protocols, procedures, programs, and concepts, as well as meeting notes, opinions, and sometimes humor. For more information on the history of the RFC series, see "30 years of RFCs".
The official specification documents of the Internet Protocol suite that are defined by the Internet Engineering Task Force (IETF) and the Internet Engineering Steering Group (IESG ) are recorded and published as standards track RFCs. As a result, the RFC publication process plays an important role in the Internet standards process. In addition, the RFC Editor publishes as independent submissions some RFCs that are outside the IETF process but are relevant to the Internet community. RFCs must first be published as Internet Drafts.
Monday, February 13, 2006
RegExp for Matching Non Alphanumric Characters
This Function check any nonaplhanumric characters including spaces if string is valid then it will return 0 else it will return 1.
function fnValidateAlphNumricChars($string)
{
return preg_match("/[`_~!@#$%&,.:;'<>{}()=\/\"\/\*\/\-\/\^\/\+\/\|\/\/ ]/", $string);
}
$string = "121ERERewerr21121212";
print fnValidateAlphNumricChars($string);
OutPut = 0 #VALID STRING
$string = "121E RE $ Rewerr21121212";
print fnValidateAlphNumricChars($string);
OutPut = 1 #INVALID STRING
?>
Friday, September 02, 2005
Jyve Says About SKYPE API
The winner of the competition was Jyve, a Palo Alto, California-based company that decided a year and a half ago to create interactive web sites that could send voice mails, handle call forwarding, and automatically launch instant-messaging sessions.
The company added these features, even knowing that Skype was planning to add call forwarding and other similar features on its own.
“It was a way to get a little more buzz and attention,” said Andrew Hansen, vice president of business development and channel sales at Jyve. “We found very quickly that once we showcased our talent in integrating Skype into software, we became quite popular.”
In the two months since Jyve has released its application, it has heard from many potential hardware and software partners who want the company to build customer applications around its web tools.
For example, Jyve worked closely with Multi-Link, a telephony hardware company that wanted to produce a Skype adapter, on defining its Skype strategy.
“It’s very lucrative business-wise,” said Mr. Hansen. “We are positioned to take advantage of this new economy from Skype.”
He doesn’t feel threatened by Skype’s recent move to open its API more widely to developers.
“It will also open up a lot more opportunities,” said Jyve CEO Charles Carleton. “We’re fairly well positioned and far enough ahead of the curve so we may capitalize on the opportunities more than people who are new to the APIs.”
“It’s a big enough sandbox for everyone to play in,” agreed Mr. Hansen. “It’s like Microsoft, but on a smaller scale.”
Skype too is facing increased competition in the free VoIP market with Google’s entry into the market last week with Google Talk (see Google Learns to Talk). But Skype executives also claim they don’t mind the extra competition.
“It does change the dynamics of the VoIP space and the communications landscape, but we welcome the competition,” said Mr. Pryor.
He pointed out, however, that Google has not yet released any tools for developers to tie into its VoIP utility.
“They have yet to integrate very easily with hardware and software,” said Mr. Pryor. “Google hasn’t produced an API yet to make it extensible or to integrate with hardware and software. We have a competitive advantage there since we’re reaching out to developers from the beginning, but I’m sure Google won’t be far behind.”
Skype Vs Google in VoIP
Kazaa Vets
Skype was created by Niklas Zennström and Janus Friis, the founders of Kazaa, a peer-to-peer audio exchange program, two years ago. It has rapidly moved beyond the computer-to-computer space with services such as Skype Out, which allows users to call traditional phone numbers anywhere.
The Google application is, on the other hand, still very limited, pointed out Scott Kessler, an Internet analyst with Standard & Poor’s. And it’s only available to Gmail users at this point.
“It’s uncertain if you’re going to see broad adoption,” said Mr. Kessler. “Google Talk is exceedingly limited, from having to have a Gmail account, to having to have a computer, and having someone you’re in touch with on the same network.”
Then again, Google Talk is free, at least for now. And Mr. Kessler noted that if users asked for a capability to make calls to land-line phones, Google would probably try to provide it. In other words, down the road, Google Talk could eventually become a Skype-killer.
“They’ll compete with each other, and Google might have an advantage, because their business model is not based on this offering,” said In-Stat analyst Keith Nissen. “Skype is ultimately going to have to wonder, ‘Where are we going to get money from?’”
Google derives the bulk of its revenue from online advertising. In its most recent quarter, it posted net income of $342.8 million, or $1.19 per share, on revenue of $890 million.
Analysts have often said that it needs to diversify its business model. The Mountain View, California-based company has said it isn’t going to run any ads on Google Talk.
Friday, July 08, 2005
Javascript Cookies
/**
* Sets a Cookie with the given name and value.
*
* name Name of the cookie
* value Value of the cookie
* [expires] Expiration date of the cookie (default: end of current session)
* [path] Path where the cookie is valid (default: path of calling document)
* [domain] Domain where the cookie is valid
* (default: domain of calling document)
* [secure] Boolean value indicating if the cookie transmission requires a
* secure transmission
*/
function setCookie(name, value, path, domain, secure)
{
var today = new Date();
var expires = new Date(today.getTime() + 150 * 24 * 60 * 60 * 1000);
document.cookie= name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
/**
* Gets the value of the specified cookie.
*
* name Name of the desired cookie.
*
* Returns a string containing value of specified cookie,
* or null if cookie does not exist.
*/
function getCookie(name)
{
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1)
{
begin = dc.indexOf(prefix);
if (begin != 0) return null;
}
else
{
begin += 2;
}
var end = document.cookie.indexOf(";", begin);
if (end == -1)
{
end = dc.length;
}
return unescape(dc.substring(begin + prefix.length, end));
}
/**
* Deletes the specified cookie.
*
* name name of the cookie
* [path] path of the cookie (must be same as path used to create cookie)
* [domain] domain of the cookie (must be same as domain used to create cookie)
*/
function deleteCookie(name, path, domain)
{
if (getCookie(name))
{
document.cookie = name + "=" +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}
// CALLING
<a href="#" onclick='setCookie("test", "1")'>Set
Cookie!</a>
<a href="#" onclick='alert(getCookie("test"))'>Get
Cookie!</a>
Tuesday, May 17, 2005
Example for Mod RewriteRule
RewriteEngine On
RewriteRule ^dir/(.*) /home/httpd/vhosts/jyvepresence.com/httpdocs/index.php?status=$1
#-----------------------
# URL will be
# http://www.domain.com/dir/vikrant
# It will execute index.php
# $1 == vikrant
#------------------------
RewriteRule ^/?([^/]*\.png|[^\./]*)[:;,\.]*$ /home/httpd/vhosts/jyvepresence.com/httpdocs/index.php?status=$1 [L,NS]
#-----------------------
# URL will be
# http://www.domain.com/vikrant.png OR http://www.domain.com/vikrant
# It will execute index.php
# $1 == vikrant.png OR $1 == vikrant
#------------------------
2 -------------------------------------
Old dynamic url:
www.domain.com/catalog/widgets-1234.html
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^cat\=([^&]+)\&product_id\=([^&]+)$
RewriteRule ^$ /catalog/%1-%2.html [R=301,L]
Reg Expression notes:
[^&]+ mean find any character except the "&" since it is what seperates the variables in a string. you can back reference matches in a rewrite condition using ()'s just like your rewrite rules but to call them you have to use a % instead of a $.
Benefits:
1. You don't have to hand write 1,000's of 301 redirects
2. Spiders can easily pick up the 301 and pass the scores and index the new urls much faster than having to crawl the entire site over from scratch.
3. Users clicking old dynamic urls in the SERPS will not get a 404 error. They'll go straight to the new static urls.
3 -----------------------------
Browser Dependent Content
Description:
At least for important top-level pages it is sometimes necessary to provide the optimum of browser dependent content, i.e. one has to provide a maximum version for the latest Netscape variants, a minimum version for the Lynx browsers and a average feature version for all others.
Solution:
We cannot use content negotiation because the browsers do not provide their type in that form. Instead we have to act on the HTTP header "User-Agent". The following condig does the following: If the HTTP header "User-Agent" begins with "Mozilla/3", the page foo.html is rewritten to foo.NS.html and and the rewriting stops. If the browser is "Lynx" or "Mozilla" of version 1 or 2 the URL becomes foo.20.html. All other browsers receive page foo.32.html. This is done by the following ruleset:
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/3.*
RewriteRule ^foo\.html$ foo.NS.html [L]
RewriteCond %{HTTP_USER_AGENT} ^Lynx/.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/[12].*
RewriteRule ^foo\.html$ foo.20.html [L]
RewriteRule ^foo\.html$ foo.32.html [L]
4-----------------------------------------------------
Simple Example
Just to help illustrate how you could use this information let's assume we had 3 web pages:
http://www.desilva.biz/wd_010427.php
http://www.desilva.biz/grafix_index.php
http://www.desilva.biz/hw_010506.php
and we want to re-direct our readers visiting each page above to their new versions at:
http://www.desilva.biz/refresh.html
http://www.desilva.biz/grafix.html
http://www.desilva.biz/cpuspeed.html
.htaccess
RewriteEngine on
RewriteRule ^wd_010427\.php$ refresh.html [R=301,L]
RewriteRule ^grafix_index\.php$ grafix.html [R=301,L]
RewriteRule ^hw_010506\.php$ cpuspeed.html [R=301,L]
Wednesday, March 30, 2005
Fantastic JavaScripts
Replace ASP tags with blank <% anything %>
<script language=JavaScript>
var theString
theString = "<html> vikrant </html> <% cieling 'done 'dfsfd
%> <div>rahesh </div> <% goahed %> <b>vik </b>";
theString = theString.replace(/<%.*?%>/gi,' ');
alert (theString);
</script>
HELP URL : http://www.sitepoint.com/print/expressions-javascript
Monday, March 28, 2005
Jyve-Skype in NY Times
This a news Article in NY times about the Jyve.com
Even without government intervention, however, random Skyping appears likely to continue in some form. The next phase may be more formalized Skype-enabled social networks like www.jyve.com, which connects people with similar interests and desire to practice a certain language, and www.someonenew.com, which connects people for romantic purposes. Only a few English-language social networking sites currently use Skype, but such sites in Asia have been very successful.
Jyve, according to Charles Carleton, a co-founder, will be introducing a feature in the next few months that Mr. Carleton hopes will protect the medium's social capabilities: an eBay-like feedback system to help users reject callers with a track record of inappropriate conversation. Skype is happy to leave these functions to other companies. "We're probably never going to run a dating service or language seminars," Ms. Larabee said of Skype. "Our business is the technology, not the networks."
Friday, February 18, 2005
MySQL Functions (Usefull in Programming)
1 . Concat the String
SELECT CONCAT('My', 'S', 'QL');
-> MySQL
-----------
2. Concat with Word Separator
SELECT (CONCAT_WS(",","First name","Second name","Last Name")) as fullname;
-> First name,Second name,Last Name
-----------
3. String Length
SELECT LENGTH('text');
->4
-----------
3. String Padding (Add characters to string)
String must contin 4 character long if 1st_expr is not contain 4
charater then add 3rd_expr to String.
SELECT LPAD('hi',4,'..');
-> '..hi'
SELECT RPAD('hi',4,'..');
-> 'hi'
-----------
4. String Padding (Add character to string)
SELECT LEFT('foobarbar', 5);
->'fooba'
SELECT RIGHT('foobarbar', 5);
->'arbar'
COMBINATION OF 3 & 4 Point
SELECT RPAD(LEFT('foobarbar', 5),8,'.') as str;
-> fooba...
## Miscellaneous Functions
SELECT DATABASE();
-> current Working databse
SELECT USER();-> curent User
SELECT SUBSTRING_INDEX(USER(),"@",1);
-> Concat userstring
SELECT VERSION();
->Current Mysql version
SELECT CONNECTION_ID();
-> Current connectio Id
MySql IFNULL, IF, CASE-WHEN-THEN -ELSE-END
--------------------------------------------
If 1st_ expr is null then retrun 2nd_expr
SELECT IFNULL(1,0);
-> 1
SELECT IFNULL(NULL,10);
-> 10
SELECT IFNULL(1/0,10);
-> 10
SELECT IFNULL(1/0,'yes');
-> 'yes'
--------------------------------------------------------------
CASE WHEN condiion THEN expr1 ELSE expr3 END
--------------------------------------------------------------
SELECT (CASE 2 WHEN 1 THEN "one" WHEN 2 THEN "two" ELSE "more" END) as ans;
-> two
SELECT CASE WHEN 1<0 style="color: rgb(255, 0, 0);">THEN "true" ELSE "false" END;
->false
--------------------------------------------------------------
IF(condition,expr,expr1)
--------------------------------------------------------------
SELECT IF(0.1<>0,1,0);
-> 1
SELECT IF(STRCMP('test','test1'),'no','yes');
-> no
Tuesday, February 15, 2005
How to create SubDomains by editing httpd.conf
If you want to maintain multiple domains/hostnames on your
machine you can setup VirtualHost containers for them.
Types of Virtual Hosting
1) IP-Based Virtual Hosting
2) Name-Based Virtual Hosting
3) Dynamic Virtual Hosting
Good Example how to set subDomains under NameBased Virtual Hosting :
NOTE: NameVirtualHost cannot be used without a port specifier
(e.g. :80) if mod_ssl is being used, due to the nature of the
SSL protocol.
Change Apache's httpd.conf file
NameVirtualHost 215.51.182.53
<VirtualHost 216.55.183.51>
ServerName *.yourdomain.com
ServerAlias yourdomain.com
DocumentRoot /home/rootdir #Directory where Scritpting files are located.
ErrorLog logs/error_log #Error are recorded in error_log file located /var/logs/httpd
CustomLog logs/visit_log combined # URL visit information recorded in visit_log file located /var/logs/httpd
</VirtualHost>
<VirtualHost 216.55.183.51>
ServerName subdomain.youydomain.com
ServerAlias subdomain.youydomain.com
DocumentRoot /home/rootdir/subdomain
ErrorLog logs/error_log
CustomLog logs/visit_log
</VirtualHost>
<VirtualHost 216.55.183.51>
ServerName subdomain1.youydomain.com
ServerAlias subdomain1.youydomain.com
DocumentRoot /home/rootdir/subdomain
ErrorLog logs/error_log
CustomLog logs/visit_log
</VirtualHost>
NOTE :
You can create n number of SubDoamins on one IP address
Apache's Module (Somthing useful in httpd.conf for Web Programmer)
httpd.conf file then copy following line once into your server
httpd.conf file. And later if you want to add new Module then edit subdomain.conf
and restart the server.
#------------------------------------------
Include /home/jyve_conf/subdomain.conf
#------------------------------------------
DirectoryIndex: sets the file that Apache will serve if a directory
is requested. If you requested http://yourdomain.com then server will automatically search index.html first for default file if not found then search for any mathch in the follwing list. You can list any file which you want to serve as default when user request for directory
#-------------------------------------------------------
DirectoryIndex index.html index.html.var index.php3
#-------------------------------------------------------
if your .htaccess is file is not working then add following lines in httpd.conf
(red) is folder path where .htaccess file located.
#-------------------------------------------------------------
<Directory /home/vikrant/userprofile>
AllowOverride All
</Directory>
#-------------------------------------------------------------
Important Linux Commands
--------------------------------
tar -zxf 18012005.tar vikrant/
tar -zcf newtitle.tar *.php
unzip myzip.zip
Folder SIZE
----------------
du -skh * | less -- Check the folder size
du -skh *| grep M | less -- Check the folder size which has MB
SCP:
-------------
-->Upload File to Server
# scp config.php username@www.youdomain.com:/home/rootdir/filename.php
-->Download file from server on Currnet directory.
# scp username@www.youdomain.com:/home/rootdir/filename.php .
Fetch (Download files from server)
-----------------------------------------
#wget http://yuordomain.com .
List Contents of Directory
---------------------------------
ls -l | wc -- (Get Number of Files /Content)
ls -lah -- (Human redable file size)
Check ServerLoad
----------------------
w
CronTab Quick Reference
cron is a unix utility that allows tasks to be automatically run in the background at regular intervals by the cron daemon often termed as cron jobs.
Crontab (CRON TABle) is a file which contains the schedule of cron entries to be run and at specified times.
Restriction
You can execute crontab if your name appears in the file
/usr/lib/cron/cron.allow. If that file does not exist, you can use
crontab if your name does not appear in the file
/usr/lib/cron/cron.deny.
If only cron.deny exists and is empty, all users can use crontab. If neither file exists, only the root user can use crontab. The allow/deny files consist of one user name per line.
Commands
export EDITOR=vi ;to specify a editor to open crontab file.
crontab -e Edit your crontab file, or create one if it doesn't already exist.
crontab -l Display your crontab file.
crontab -r Remove your crontab file.
crontab -v Display the last time you edited your crontab file. (This option is only available on a few systems.)
Crontab File
A crontab file has five fields for specifying day , date and time followed by the command to be run at that interval.
* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (1 - 7) (monday = 1)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
Environment
cron invokes the command from the user's HOME directory with the shell, (/usr/bin/sh).
cron supplies a default environment for every shell, defining:
HOME=user's-home-directory
LOGNAME=user's-login-id
PATH=/usr/bin:/usr/sbin:.
SHELL=/usr/bin/sh
Users who desire to have their .profile executed must explicitly do so
in the crontab entry or in a script called by the entry.
Disable Email
By default cron jobs sends a email to the user account executing the cronjob. If this is not needed put the following command At the end of the cron job line .
>/dev/null 2>&1
Generate Log File
To collect the cron execution execution log in a file :
30 18 * * * rm /home/someuser/tmp/* > /home/someuser/cronlogs/clean_tmp_dir.log
Examples :
Cron set For Database BackUp
5 21 * * * mysqldump -u root -pclarion --opt specto | gzip > /backup1/amodd/spec
to_`date +%Y%m%d%H%M`.gz
Cron Set for run PHP File ..
* 0,6,12,18 * * * /usr/bin/php -q /var/www/html/vikrant/goskype/expertblog/blogsadmin/runcron.php > /dev/null
HTTP Authentication to Folder. (.htaccess /.htpasswd)
authonticate.
Change the path (In red) and enter the Folder path which you want to authenticate.
------------------------------------------------------------------
AuthUserFile /mnt/web/guide/somewhere/somepath/.htpasswd
AuthGroupFile /dev/null
AuthName "Somewhere.com's Secret Section"
AuthType Basic
<Limit GET POST>
require valid-user
</Limit>
--------------------------------------------------------------------
To create an .htpasswd file, login to the server via telnet(Command line) go to the directory you specified in AuthUserFile. In the example, this is /mnt/web/guide/somewhere/somepath. Then use the htpasswd program with the -c switch to create your .htpasswd in the current directory. (as per following)
----------------------------------------
htpasswd -c .htpasswd username
Adding password for username.
New password:
password
Re-type new password:
password
---------------------------------------
To delete users, open the .htpasswd file in a text editor and delete the appropriate lines:
Execute PHP syntax in .HTML file
Then Follow following procedures.
1. Write Following code in the .htaccess file
---------------------------------------------
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
-----------------------------------------------------
2. Upload it to your server (to your WWW root) where your
.html files are located in which contains PHP code.
Thats the idea.
Wednesday, December 08, 2004
What Is osCommerce?
Strong eCommerce Tool .
|
1. http://wiki.oscommerce.com
2. http://forums.oscommerce.com
osCommerce is an online shop e-commerce solution under on going development by the open source community. Its feature packed out-of-the-box installation allows store owners to setup, run, and maintain their online stores with minimum effort and with absolutely no costs or license fees involved.
osCommerce combines open source solutions to provide a free and open e-commerce platform, which includes the powerful PHP web scripting language, the stable Apache web server, and the fast MySQL database server.
With no restrictions or special requirements, osCommerce is able to run on any PHP enabled web server, on any environment that PHP and MySQL supports, which includes Linux, Solaris, BSD, Mac OS X, and Microsoft Windows environments.
osCommerce was started in March 2000 and has since matured to a solution that is currently powering thousands of live shops around the world.
Today, osCommerce has been taken to the next level, moving towards an e-commerce framework solution that not only remains easy to setup and maintain, but also making it easier for store administrators to present their stores to their customers with their own unique requirements.
The success of osCommerce is secured by a dedicated team and a great and active community where members help one another out and participate in development issues reflecting upon the current state of the project.
Monday, November 22, 2004
LDAP
As soon as Internet email became popular, it was clear we needed a good phone book. Printed directories were obsolete before the ink was dry. Older Internet methods of looking up names, such as whois, Ph, or finger, were limited or arcane. Every email program has a personal address book, but how do you look up an address for someone who's never sent you email? How can an organization keep one centralized up-to-date phone book that everybody has access to?
That's why software companies such as Microsoft, IBM, Lotus, and Netscape agreed to support a standard called LDAP. "LDAP-aware" client programs can ask LDAP servers to look up entries in a wide variety of ways. LDAP servers index all the data in their entries, and "filters" may be used to select just the person or group you want, and return just the information you want. For example, here's an LDAP search translated into plain English: "Search for all people located in Chicago whose name contains "Fred" that have an email address. Please return their full name, email, title, and description." (However, many email clients have more limited search and retrieval options.)
"Permissions" are set by the administrator to allow only certain people to access the LDAP database, and optionally keep certain data private. LDAP servers also provide "authentication" service, so that web, email, and file-sharing servers (for example) can use a single list of authorized users and passwords.
LDAP was designed at the University of Michigan to adapt a complex enterprise directory system (called X.500) to the modern Internet. A directory server runs on a host computer on the Internet, and various client programs that understand the protocol can log into the server and look up entries. X.500 is too complex to support on desktops and over the Internet, so LDAP was created to provide this service "for the rest of us."
LDAP servers exist at three levels: There are big public servers such as BigFoot and Infospace, large organizational servers at universities and corporations, and smaller LDAP servers for workgroups.
You probably already have an LDAP-aware client installed on your computer. Most modern email clients are set up to search an LDAP directory for email addresses. These include Outlook, OS X Mail, Eudora, Netscape, QuickMail Pro, and Mulberry.
LDAP has broader applications, such as looking up services and devices on the Internet (and intranets). Netscape Communicator can store user preferences and bookmarks on an LDAP server. There is even a plan for linking all LDAP servers into a worldwide hierarchy, all searchable from your client.
LDAP promises to save users and administrators time and frustration, making it easy for everyone to connect with people without frustrating searches for email addresses and other trivia.
Wednesday, October 13, 2004
PHP5 and OOPs
New Object Model
In PHP 5 there is a new Object Model. PHP's handling of objects has been completely rewritten, allowing for better performance and more features. In previous versions of PHP, objects were handled like primitive types (for instance integers and strings). The drawback of this method was that semantically the whole object was copied when a variable was assigned, or pass as a parameter to a method. In the new approach, objects are referenced by handle, and not by value (one can think of a handle as an object's identifier).
Many PHP programmers aren't even aware of the copying quirks of the old object model and, therefore, the majority of PHP applications will work out of the box, or with very few modifications.
The new Object Model is documented at the Language Reference.
Saturday, October 02, 2004
Skype - Jyve
What is Jyve.com?
Author : Vikrant LabdeProgrammer of Jyve.com
Jyve.com is one of the biggest site which helps skype to improve the skype community.
Advantages of Jyve.com
Jyve has provides very strong features which are totally integrated with the Skype
such as Jyve Groups
Jyve Mails
Jyve Forums
Jyve YellowPages
Jyve ContactSystem
Jyve Blog
and many other features .
Directory Search.
Jyve has managed aprox.3000 Interests crateria. Now you can find people for your interest on Jyve and contact that user Via Skype or IM that user via Skype .
Now Dont West Time ! and Join Skype Community.
Posted By: Vikrant Labde
Softwate Engineer
(Clarion Technologies)
Email Me : vikrantlabde@yahoo.com
vikrantlabde @hotmail.com
What is Skype?
Hello. We’re Skype and we’ve got something we want to share with you.
We’ve got a simple bit of software we want to give you. It’ll let you make free phone calls to your friends all over the world. And we don’t want any money for it. It’s free.
You could think of us as the big, free Internet telephony company. We prefer to think of ourselves as a big group hug, even a present. Yes… that’s it… we’re a present… but without the ribbon.
Our software’s quick and easy to install. Just download Skype, register and within minutes you can plug in your headset, speakers or USB phone and call your friends. The calls have excellent sound quality and are highly secure with end-to-end encryption. You don’t even need to reconfigure your firewall or router. It just, you know… works.
You can also use our SkypeOut function to make calls to friends who only have a landline or mobile phone anywhere in the world at local rates. You can even transfer files of up to 2 gigabytes.
Now what do we ask of you in return? A bag of seed? A back rub? The keys to your city? No. We just want you to share us with all your friends. Why? Well, you can only speak to your friends for free on Skype, if they’re also using Skype. So the more people you share it with, the more people you can talk to. Simple when you think about it… so, is it a deal?
» Learn more about Skype
» P2P telephony explained – for geeks only
» More information on SkypeOut and SkypeOut prices
When will version 1.0 for Linux arrive?
The version 1.0 release that was launched on July 27 was for the Windows platform, as well as the SkypeOut service. The Linux version 1.0 is on its way and new versions are coming out for closed testing all the time and will reach the public once they're ready. There will not be a significant leap in features between before-1.0 and post-1.0 versions - it's a gradual evolution as we continuously innovate and improve the software.
How does Skype compete with for example MSN which has the largest share of the instant messaging market?
Skype offers free superior sound quality Internet telephony. In addition, it includes:
- Conference calling - enables simultaneous and seamless voice communication between groups of up to five friends, family or colleagues. The Linux version currently has only conference client but will have hosting too.
- Global Directory - the user-built global Skype contacts directory with numerous search options and an easy add-a-contact tool
- Customization - My Picture image display
- Mobility - login into Skype account on more than one PC anywhere in the world.
- Multiple Skype accounts on one PC
In comparison with other IM/voice clients, we can ensure:
- Better usability in networks. MSN and many other VoIP providers have voice calls, but those cannot penetrate firewalls or NAT. Skype has solved this problem. The same goes for other forms of communication (file transfers, instant messages) that sometimes don't go through firewalls.
- Better performance. MSN is server-based, meaning that performance suffers in peak hours and users simply cannot do voice calls due to server overload. Skype calls are truly P2P, involving the distributed network itself for routing calls, so it scales up very well and does not suffer from this kind of performance problems.
We are working on adding more user requested features to the software, such as video calling, etc.
Why Skype writing software for Linux?
Skype for Linux was one of the most requested developments from our user base, but also because we see Linux as an important emerging PC desktop platform. This is illustrated by the fact that many major vendors are starting to offer Linux systems (HP, Sun, IBM to name just a few), and that many companies, government institutions and local governments in Europe, Asia and elsewhere have announced their migration to Linux. The proportion of Skype for Linux users is still small as compared to those running it on Windows, but we expect it to increase over the coming years.
Simply put, we want everyone to be able to run Skype and talk to their friends, family and colleagues, regardless of what platform they use or whether they have a computer at all. Embedded and mobile devices, some of them on Embedded Linux, are an important future development path for Skype.
How many people are working fulltime on Skype?
We have approximately 45 people working on Skype.
Skype launches Pocket PC software
Peer-to-peer IP telephony startup Skype yesterday released a version of its software designed for mobile devices running Microsoft's PocketPC operating system. Skype for Pocket PC version 1.0 allows users of wireless LAN-enabled PDAs running Microsoft's Windows Mobile 2003 for Pocket PC to make Voice over IP calls from Wi-Fi hotspots. As with PC versions of the software, the technology allows users to make free voice calls to other Skype users over a broadband P2P network. Skype for Pocket PC enables cross-platform voice calls to other Skype users running either Windows, Linux or the recently released Mac OS X versions of Skype. All Skype software is free. The Pocket PC version of SkypeInstalling the software on a HP iPAQ Pocket PC 5500 proved straightforward. We were able to easily set up a pair of calls and the voice quality was surprisingly good, providing you both remember not to attempt talking at the same time. Oddly, it was easier to have a clear conversation with someone in the Northampton area than someone in the office next door.
The release is something of a boon for geeks who will be able to use the software to turn WiFi-enabled iPAQ and the like into something resembling Star Trek-style communicators. Skype users control their online presence and contact lists, and have options to customise their overall experience.
Skype for Pocket PC Free offers end-to-end encryption for privacy along with conference calling and instant messaging features. The application includes a service, called SkypeOut, that allows Skype users to pre-pay and use their computing device and Internet connection to call landlines and mobile phones anywhere in the world at local rates (pricelist here). SkypeOut pricing starts at approximately two cents per minute (for the US, Western Europe and Australia). Rates in the developing world are far more expensive.
"With the launch of Skype for Pocket PC 1.0, Skype is expanding consumer choice in mobile, global communications by offering free Skype-to-Skype calling and affordable SkypeOut calls to any traditional phone number," said Niklas Zennström, Skype chief executive and co-founder. "We are delivering greater platform and portability options for consumers looking to take advantage of the cost and quality benefits of internet telephony. We will continue to expand platform choices for our users."